{
ID : phamnamlo2
PROB : cowturn
LANG : PASCAL
}

program cowturn;
const
  fi = 'cowturn.in';
  fo = 'cowturn.out';
  max = 5000;
  oo = 1000000000;
var
  a, b : array[1..max] of longint;
  t : array[1..max] of longint;
  n, m, k, minm, mink : longint;

procedure inp;
var
  i : longint;
  c : char;
begin
  readln(n);
  for i := 1 to n do
  begin
    readln(c);
    if c = 'F' then a[i] := 0
    else a[i] := 1;
  end;
end;

function solve(k : longint) : longint;
var
  i, j, sum : longint;
  turn : longint;
begin
  a := b;
  sum := 0;
  turn := 0;
  fillchar(t, sizeof(t), 0);
  for i := 1 to n-k+1 do
  begin
    if i-k > 0 then turn := turn xor t[i-k];
    if a[i] xor turn = 1 then
    begin
      turn := turn xor 1;
      t[i] := 1;
      inc(sum);
    end
    else t[i] := 0;
  end;
  for i := n-k+2 to n do
  begin
    if i-k > 0 then turn := turn xor t[i-k];
    if a[i] xor turn = 1 then
    begin
      solve := oo;
      exit;
    end;
  end;
  solve := sum;
end;

procedure process;
begin
  b := a;
  minm := oo;
  mink := oo;
  for k := 1 to n do
  begin
    m := solve(k);
    if m < minm then
    begin
      minm := m;
      mink := k;
    end;
  end;
end;

procedure out;
begin
  writeln(mink, ' ', minm);
end;

begin
  assign(input, fi); reset(input);
  assign(output, fo); rewrite(output);

  inp;
  process;
  out;

  close(output);
  close(input);
end.
